<template>
  <div>
    <!-- <el-button type="success" size="mini" round @click="handleAdd"
      >新增</el-button
    > -->

    <el-table :data="tableData" border size="mini" style="width: 100%">
      <el-table-column type="index" />
      <el-table-column prop="frontId" label="id" align="center">
      </el-table-column>
      <el-table-column
        prop="data"
        label="数据"
        align="center"
        show-overflow-tooltip
      >
        <template #default="{ row }">
          {{ JSON.stringify(row.data) }}
        </template>
      </el-table-column>
      <el-table-column prop="time" label="时间" align="center">
      </el-table-column>
      <el-table-column  align="center">
        <template slot="header">
          <el-button type="success" size="mini" round @click="handleAdd"
            >新增</el-button
          >
        </template>

        <template #default="{ row }">
          <el-button type="primary" size="mini" @click="deleteFn(row)"
            >删除</el-button
          >
          <el-button type="success" size="mini" @click="editFn(row)"
            >编辑</el-button
          >
          <el-button type="info" size="mini" @click="showForm(row)">查看表单</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  data () {
    return {
      tableData: JSON.parse(localStorage.getItem('ngData')) || []
    }
  },
  created () {},
  methods: {
    handleAdd () {
      this.$router.push({
        path: '/ngFormCom',
        query: {
          isEdit: false
        }
      })
    },
    editFn (row) {
      this.$router.push({
        path: '/ngFormCom',
        query: {
          isEdit: true,
          frontId: row.frontId
        }
      })
    },
    showForm (row) {
      this.$router.push({
        path: '/ngFormBuild',
        query: {
          frontId: row.frontId
        }
      })
    }
  }
}
</script>

<style>
</style>
